//
//  YZMTradeRealModel.m
//  YZMicroStock
//
//  Created by wangminhong on 16/6/1.
//  Copyright © 2016年 cqjr. All rights reserved.
//

#import "YZMTradeRealModel.h"
#import "YZMTradeTypeDef.h"
#import "NSNumber+Utils.h"

@implementation YZMTradeRealModel

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    
    return nil;
}

+ (id)yz_transFormWithData:(id)data error:(NSError **)error
{
    NSString *contents = data;
    if (contents.length == 0) {
        
        return nil;
    }
    NSArray *array = [contents componentsSeparatedByString:@","];
    
    if (array.count < 14) {
        
        return nil;
    }
    YZMTradeRealModel *model = [[self class] new];
    model.agreementCode = array[0];
    model.time = floor([array[1] doubleValue]/1000);
    model.openPrice = [array[2] doubleValue];
    model.lastClosePrice = [array[3] doubleValue];
    model.changeValue = [array[4] doubleValue];
    model.changeRange = [array[5] doubleValue];
    model.highPrice = [array[6] doubleValue];
    model.lowPrice = [array[7] doubleValue];
    model.dealCount = [array[8] longLongValue];
    model.price = [array[9] doubleValue];
    model.buyPrice = [array[10] doubleValue];
    model.sellPrice = [array[11] doubleValue];
    model.buyCount = [array[12] integerValue];
    model.sellCount = [array[13] integerValue];

    return model;
}

- (NSString *)formatPrice:(double)price{
    
    return nil;
}

@end


@implementation YZMHangSengRealModel

- (NSString *)formatPrice:(double)price{
    
    return @(price).p0fString;
}

@end

@implementation YZMGoldRealModel

- (NSString *)formatPrice:(double)price{
    
    return @(price).p01fString;
}

@end

@implementation YZMCrudeRealModel

- (NSString *)formatPrice:(double)price{
    
    return @(price).p02fString;
}

@end
